﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using IHISCETeim.BLL;


namespace IHISCETeim.Web.MachineSys.MacModel
{
    public partial class ExportVINList : VINList
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.导出 };
            }
        }

        protected override string DWZRef
        {
            get
            {
                return "VINList";
            }
        }
        protected int usertype {
            get {
                return GetRequestValue<int>("usertype", 0);
            }
        }

        protected  void Page_Load(object sender, EventArgs e)
        {
            if(usertype==0)
                DataBind1();
            else
                DataBind2();
        }
        private void DataBind1()
        {
            rpMenu1.Visible = true;
            rpMenu2.Visible = false;
            this.rpMenu1.DataSource = VINController.GetPagination(GetSql(), 1, 9999999, SQLSort, ref TotalCount);
            this.rpMenu1.DataBind();

            ExportToExecl(string.Format("环保代码列表清单{0}－上传专用",DateTime.Now.ToString("yyyymMMdd")), this.rpMenu1);
        }

        private void DataBind2()
        {
            rpMenu1.Visible = false;
            rpMenu2.Visible = true;
            this.rpMenu2.DataSource = VINController.GetPagination(GetSql(), 1, 999999999, SQLSort, ref TotalCount);
            this.rpMenu2.DataBind();

            ExportToExecl(string.Format("环保代码列表清单{0}-内部专用", DateTime.Now.ToString("yyyymMMdd")), this.rpMenu2);
        }
    }
}